%% term_grad_P_grad_Q
function matrix_A = term_grad_P_grad_Q(mesh, fespace)
Nb1 = fespace.Nb;
Nlb1 = fespace.Nlb;
rows = zeros(mesh.Ne*Nlb1*Nlb1,1);
cols = rows;
val = rows;
flag = 1;
for n = 1:mesh.Ne
    V = mesh.node(mesh.elem(n,:),:);
    [int_points_loc, int_weights_loc] = integral_loc(V, "2d");
    phix = basis_loc(V, int_points_loc(:,1), int_points_loc(:,2), fespace.basis_type, "dx");
    phiy = basis_loc(V, int_points_loc(:,1), int_points_loc(:,2), fespace.basis_type, "dy");
    for i = 1:Nlb1
        for j = 1:Nlb1
            f = phix(:,j).*phix(:,i) + phiy(:,j).*phiy(:,i);
            r = int_weights_loc * f;
            rows(flag) = fespace.elem(n,i);
            cols(flag) = fespace.elem(n,j);
            val(flag) = r;
            flag = flag + 1;
        end
    end
end
matrix_A = sparse(rows, cols, val, Nb1, Nb1);
end